
<%@page import="cl.mt.proxy.ProxyPais"%>
<%@page import="cl.mt.proxy.ProxyRegion"%>
<%@page import="cl.mt.proxy.ProxyCiudad"%>
<%@page import="java.util.Collection"%>
<%@page import="cl.mt.dto.DTOPais"%>
<%@page import="cl.mt.dto.DTORegion"%>
<%@page import="cl.mt.dto.DTOCiudad"%>

<%
String jsListaPais = "";
ProxyPais  proxyPais = ProxyPais.getInstance();
Collection<DTOPais> colPais = proxyPais.getLista();
for (java.util.Iterator<DTOPais> it=colPais.iterator(); it.hasNext(); ) {
	DTOPais dto = it.next();
	jsListaPais += "PAIS[PAIS.length] = '" + dto.getId() + "#" + dto.getDescripcion() + "';\n";
}

ProxyRegion proxyRegion = ProxyRegion.getInstance();
Collection<DTORegion> colRegion= proxyRegion.getLista();
for (java.util.Iterator<DTORegion> it=colRegion.iterator(); it.hasNext(); ) {
	DTORegion dto = it.next();
	jsListaPais += "REGI[REGI.length] = '" + dto.getIdPais() + "#" + dto.getId() + "#" + dto.getDescripcion() + "';\n";
}

%>
<script language="JavaScript">
<!--
var PAIS = new Array();
var REGI = new Array();
<%= jsListaPais %>


function cargaPais(forma, tipo, idPais, idRegion, idComuna) {
	if ( tipo=="Origen" )
		changeComboInicial( forma.idPaisOrigen, PAIS, idPais);
	else 
		changeComboInicial( forma.idPaisDestino, PAIS, idPais);
	cargaRegion(forma, tipo, idPais, idRegion, idComuna);	
}

function cargaRegion(forma, tipo, idPais, idRegion, idComuna) {
	if ( tipo=="Origen" )
		changeCombos( forma.idPaisOrigen, forma.idRegionOrigen, REGI, idRegion);
	else 
		changeCombos( forma.idPaisDestino, forma.idRegionDestino, REGI, idRegion);
}
// -->
</script>
<div id="filtroTransporte">
<table width="100%" border="0">
	<tr>
		<td width="221" rowspan="2" valign="top">Fecha Desde <input
			name="fechaDesde" type="text" id="fechaDesde" size="15" /> <img
			src="${pageContext.request.contextPath}/images/calendar.gif" alt=""
			width="13" height="12"
			onclick="displayCalendar(document.form.fechaDesde,'dd/mm/yyyy',this)" />

		</td>
		<td width="91" rowspan="2" valign="top">Origen</td>
		<td width="50" valign="top">Pa&iacute;s</td>
		<td width="216" valign="top"><select name="idPaisOrigen" onChange="cargaRegion(this.form, 'Origen', '', '', '');">
			<option value="">SELECCIONE</option>
		</select></td>
	</tr>
	<tr>
		<td valign="top">Regi&oacute;n</td>
		<td valign="top"><select name="idRegionOrigen" >
			<option value="">SELECCIONE</option>
		</select></td>
	</tr>
	<tr>
		<td rowspan="2" valign="top">Fecha Hasta <input name="fechaHasta"
			type="text" id="fechaHasta" size="15" /> <img
			src="${pageContext.request.contextPath}/images/calendar.gif" alt=""
			width="13" height="12"
			onclick="displayCalendar(document.form.fechaHasta,'dd/mm/yyyy',this)" />
		</td>
		<td rowspan="2" valign="top">Destino</td>
		<td valign="top">Pa&iacute;s</td>
		<td valign="top"><select name="idPaisDestino" onChange="cargaRegion(this.form, 'Destino', '', '', '');">
			<option value="">SELECCIONE</option>
		</select>
		</td>
	</tr>
	<tr>
		<td valign="top">Regi&oacute;n</td>
		<td valign="top"><select name="idRegionDestino">
			<option value="">SELECCIONE</option>
		</select></td>
	</tr>
	<tr>
		<td valign="top">&nbsp;</td>
		<td colspan="3" valign="top"><div align="right"><input type="submit" name="Buscar"
			value="Buscar" onclick="validarFechas();" /></div>
		</td>
	</tr>
</table>
</div>
<script language="JavaScript">
<!--
cargaPais(document.forma, 'Origen', '', '', '');
cargaPais(document.forma, 'Destino', '', '', '');
//-->
</script>